Compositional and Lightweight Dependent Type Inference for ML
نویسندگان
چکیده
We consider the problem of inferring expressive safety properties of higher-order functional programs using first-order decision procedures. Our approach encodes higher-order features into first-order logic formula whose solution can be derived using a lightweight counterexample guided refinement loop. To do so, we extract initial verification conditions from dependent typing rules derived by a syntactic scan of the program. Subsequent type-checking and type-refinement phases infer and propagate specifications of higher order functions, which are treated as uninterpreted first-order constructs, via subtyping chains. Our technique provides several benefits not found in existing systems: (1) it enables compositional verification and inference of useful safety properties for functional programs; (2) additionally provides counterexamples that serve as witnesses of unsound assertions: (3) does not entail a complex translation or encoding of the original source program into a first-order representation; and, (4) most importantly, profitably employs the large body of existing work on verification of first-order imperative programs to enable efficient analysis of higher-order ones. We have implemented the technique as part of the MLton SML compiler toolchain, where it has shown to be effective in discovering useful invariants with low annotation burden.
منابع مشابه
Compositionality, Inference and Concurrency
Finding compositional design methods for concurrent software is made difficult by the inevitable interference between components about which one would like to reason independently. This paper reviews some of the research on rea-sonning about –and limiting– interference. It can be argued that there is as yet no entirely satisfactory compositional method and another purpose of the paper is to exp...
متن کاملLightweight Lemmas in Prolog 1
Prolog is known to be well-suited for expressing and implementing logics and inference systems. We show that lemmas and deenitions in such logics can be implemented with a great economy of expression. We encode a polymorphic higher-order logic using the ML-style polymorphism of Prolog. The terms of the metalanguage (Prolog) can be used to express the statement of a lemma, and metalanguage type-...
متن کاملDouble Fuzzy Implications-Based Restriction Inference Algorithm
The main condition of the differently implicational inferencealgorithm is reconsidered from a contrary direction, which motivatesa new fuzzy inference strategy, called the double fuzzyimplications-based restriction inference algorithm. New restrictioninference principle is proposed, which improves the principle of thefull implication restriction inference algorithm. Furthermore,focusing on the ...
متن کاملLightweight Family Polymorphism
Family polymorphism has been proposed for object-oriented languages as a solution to supporting reusable yet type-safe mutually recursive classes. A key idea of family polymorphism is the notion of families, which are used to group mutually recursive classes. In the original proposal, due to the design decision that families are represented by objects, dependent types had to be introduced, resu...
متن کاملImproving the Precision of Type Inference Algorithms with Lightweight Heuristics
Dynamically-typed languages allow faster software development by not posing the type constraints. Static type information facilitates program comprehension and software maintenance. Type inference algorithms attempt to reconstruct the type information from the code, yet they suffer from the problem of false positives or false negatives. The use of complex type inference algorithms is questionab...
متن کامل